﻿using DLL;
using NursingFormSystem.Common;
using NursingFormSystem.Model;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace NursingFormSystem.NursingRecordsIntegration
{
    public partial class AddNursingRecordsIntegration : Form
    {
        NursingFormRecord record = new NursingFormRecord();
        NurFormsService.NursingForm formService = new NurFormsService.NursingForm();
        Tb_User LoginUser;
        PatientInfo PatientInfo;
        string Id;

        public AddNursingRecordsIntegration(Tb_User loginUser, PatientInfo patientInfo)
        {
            InitializeComponent();
            this.LoginUser = loginUser;
            this.PatientInfo = patientInfo;
            BindInfo(this.Id);
        }
        public AddNursingRecordsIntegration(string[] loginUser, string[] patientInfo)
        {
            InitializeComponent();
            this.LoginUser = ArrayToObject.ArrayToLoginUser(loginUser);
            this.PatientInfo = ArrayToObject.ArrayToPatientInfo(patientInfo);
            BindInfo(this.Id);
        }
        private void BindInfo(string id)
        {
            dateriqi.DateTime = DateTime.Now;   //显示当前日期
            var ret = formService.GetNursingFormRecordOrderByTime(PatientInfo.PATIENT_ID, PatientInfo.VISIT_ID, (int)FormType.NursingRecordsIntegration, 1);
            if (ret.Code == 1)
            {
                List<NursingFormRecord> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<NursingFormRecord>>(ret.D);
                if (string.IsNullOrEmpty(id))
                    record = list[0];
                else
                    record = list.Find(p => p.Id == Convert.ToInt32(id));
                this.Id = record.Id.ToString();
                var NursingFormData = record.NursingFormData;
                Model.NursingRecordsIntegration nri = new Model.NursingRecordsIntegration();
                nri = XmlUtil.XMLToObject<Model.NursingRecordsIntegration>(NursingFormData, Encoding.UTF8);
                dateriqi.DateTime = Convert.ToDateTime(nri.RiQi);
                #region 生命体征
                if (!string.IsNullOrEmpty(nri.ShengMingTiZheng.T))
                {
                    var t = nri.ShengMingTiZheng.T.Split('#');
                    txtTiWen1.Text = t[0];
                    txtTiWen2.Text = t[1];
                    txtTiWen3.Text = t[2];
                    txtTiWen4.Text = t[3];
                    txtTiWen5.Text = t[4];
                    txtTiWen6.Text = t[5];
                    txtTiWen7.Text = t[6];
                    txtTiWen8.Text = t[7];
                    txtTiWen9.Text = t[8];
                    txtTiWen10.Text = t[9];
                    txtTiWen11.Text = t[10];
                    txtTiWen12.Text = t[11];
                }

                if (!string.IsNullOrEmpty(nri.ShengMingTiZheng.HR))
                {
                    var hr = nri.ShengMingTiZheng.HR.Split('#');
                    txtHrp1.Text = hr[0];
                    txtHrp2.Text = hr[1];
                    txtHrp3.Text = hr[2];
                    txtHrp4.Text = hr[3];
                    txtHrp5.Text = hr[4];
                    txtHrp6.Text = hr[5];
                    txtHrp7.Text = hr[6];
                    txtHrp8.Text = hr[7];
                    txtHrp9.Text = hr[8];
                    txtHrp10.Text = hr[9];
                    txtHrp11.Text = hr[10];
                    txtHrp12.Text = hr[11];
                }

                if (!string.IsNullOrEmpty(nri.ShengMingTiZheng.R))
                {
                    var r = nri.ShengMingTiZheng.R.Split('#');
                    txtR1.Text = r[0];
                    txtR2.Text = r[1];
                    txtR3.Text = r[2];
                    txtR4.Text = r[3];
                    txtR5.Text = r[4];
                    txtR6.Text = r[5];
                    txtR7.Text = r[6];
                    txtR8.Text = r[7];
                    txtR9.Text = r[8];
                    txtR10.Text = r[9];
                    txtR11.Text = r[10];
                    txtR12.Text = r[11];
                }

                if (!string.IsNullOrEmpty(nri.ShengMingTiZheng.BP))
                {
                    var bp = nri.ShengMingTiZheng.BP.Split('#');
                    txtBP1.Text = bp[0];
                    txtBP2.Text = bp[1];
                    txtBP3.Text = bp[2];
                    txtBP4.Text = bp[3];
                    txtBP5.Text = bp[4];
                    txtBP6.Text = bp[5];
                    txtBP7.Text = bp[6];
                    txtBP8.Text = bp[7];
                    txtBP9.Text = bp[8];
                    txtBP10.Text = bp[9];
                    txtBP11.Text = bp[10];
                    txtBP12.Text = bp[11];
                }

                if (!string.IsNullOrEmpty(nri.ShengMingTiZheng.SPO2))
                {
                    var sp = nri.ShengMingTiZheng.SPO2.Split('#');
                    txtSOP1.Text = sp[0];
                    txtSOP2.Text = sp[1];
                    txtSOP3.Text = sp[2];
                    txtSOP4.Text = sp[3];
                    txtSOP5.Text = sp[4];
                    txtSOP6.Text = sp[5];
                    txtSOP7.Text = sp[6];
                    txtSOP8.Text = sp[7];
                    txtSOP9.Text = sp[8];
                    txtSOP10.Text = sp[9];
                    txtSOP11.Text = sp[10];
                    txtSOP12.Text = sp[11];
                }
                #endregion

                #region 意识
                if (!string.IsNullOrEmpty(nri.YiShi.YiShiZhuangTai))
                {
                    var yisi = nri.YiShi.YiShiZhuangTai.Split('#');
                    txtYszt1.Text = yisi[0];
                    txtYszt2.Text = yisi[1];
                    txtYszt3.Text = yisi[2];
                    txtYszt4.Text = yisi[3];
                    txtYszt5.Text = yisi[4];
                    txtYszt6.Text = yisi[5];
                    txtYszt7.Text = yisi[6];
                    txtYszt8.Text = yisi[7];
                    txtYszt9.Text = yisi[8];
                    txtYszt10.Text = yisi[9];
                    txtYszt11.Text = yisi[10];
                    txtYszt12.Text = yisi[11];
                }

                if (!string.IsNullOrEmpty(nri.YiShi.TongKongDaXiao))
                {
                    var tongkong = nri.YiShi.TongKongDaXiao.Split('#');
                    txtTkdx1.Text = tongkong[0];
                    txtTkdx2.Text = tongkong[1];
                    txtTkdx3.Text = tongkong[2];
                    txtTkdx4.Text = tongkong[3];
                    txtTkdx5.Text = tongkong[4];
                    txtTkdx6.Text = tongkong[5];
                    txtTkdx7.Text = tongkong[6];
                    txtTkdx8.Text = tongkong[7];
                    txtTkdx9.Text = tongkong[8];
                    txtTkdx10.Text = tongkong[9];
                    txtTkdx11.Text = tongkong[10];
                    txtTkdx12.Text = tongkong[11];
                }

                if (!string.IsNullOrEmpty(nri.YiShi.TongKongDuiGuangFansShe))
                {
                    var tongkongduiguang = nri.YiShi.TongKongDuiGuangFansShe.Split('#');
                    txtTkdgfs1.Text = tongkongduiguang[0];
                    txtTkdgfs2.Text = tongkongduiguang[1];
                    txtTkdgfs3.Text = tongkongduiguang[2];
                    txtTkdgfs4.Text = tongkongduiguang[3];
                    txtTkdgfs5.Text = tongkongduiguang[4];
                    txtTkdgfs6.Text = tongkongduiguang[5];
                    txtTkdgfs7.Text = tongkongduiguang[6];
                    txtTkdgfs8.Text = tongkongduiguang[7];
                    txtTkdgfs9.Text = tongkongduiguang[8];
                    txtTkdgfs10.Text = tongkongduiguang[9];
                    txtTkdgfs11.Text = tongkongduiguang[10];
                    txtTkdgfs12.Text = tongkongduiguang[11];
                }
                #endregion

                #region 护理
                if (!string.IsNullOrEmpty(nri.HuLi.FanShen))
                {
                    var fanshen = nri.HuLi.FanShen.Split('#');
                    txtFanshen1.Text = fanshen[0];
                    txtFanshen2.Text = fanshen[1];
                    txtFanshen3.Text = fanshen[2];
                    txtFanshen4.Text = fanshen[3];
                    txtFanshen5.Text = fanshen[4];
                    txtFanshen6.Text = fanshen[5];
                    txtFanshen7.Text = fanshen[6];
                    txtFanshen8.Text = fanshen[7];
                    txtFanshen9.Text = fanshen[8];
                    txtFanshen10.Text = fanshen[9];
                    txtFanshen11.Text = fanshen[10];
                    txtFanshen12.Text = fanshen[11];
                }

                if (!string.IsNullOrEmpty(nri.HuLi.WuHua))
                {
                    var wuhua = nri.HuLi.WuHua.Split('#');
                    txtWuhua1.Text = wuhua[0];
                    txtWuhua2.Text = wuhua[1];
                    txtWuhua3.Text = wuhua[2];
                    txtWuhua4.Text = wuhua[3];
                    txtWuhua5.Text = wuhua[4];
                    txtWuhua6.Text = wuhua[5];
                    txtWuhua7.Text = wuhua[6];
                    txtWuhua8.Text = wuhua[7];
                    txtWuhua9.Text = wuhua[8];
                    txtWuhua10.Text = wuhua[9];
                    txtWuhua11.Text = wuhua[10];
                    txtWuhua12.Text = wuhua[11];
                }

                if (!string.IsNullOrEmpty(nri.HuLi.XiTan))
                {
                    var xitan = nri.HuLi.XiTan.Split('#');
                    txtXiTan1.Text = xitan[0];
                    txtXiTan2.Text = xitan[1];
                    txtXiTan3.Text = xitan[2];
                    txtXiTan4.Text = xitan[3];
                    txtXiTan5.Text = xitan[4];
                    txtXiTan6.Text = xitan[5];
                    txtXiTan7.Text = xitan[6];
                    txtXiTan8.Text = xitan[7];
                    txtXiTan9.Text = xitan[8];
                    txtXiTan10.Text = xitan[9];
                    txtXiTan11.Text = xitan[10];
                    txtXiTan12.Text = xitan[11];
                }

                if (!string.IsNullOrEmpty(nri.HuLi.JiChuHuLi))
                {
                    var jichu = nri.HuLi.JiChuHuLi.Split('#');
                    txtJiChuHuLi1.Text = jichu[0];
                    txtJiChuHuLi2.Text = jichu[1];
                    txtJiChuHuLi3.Text = jichu[2];
                    txtJiChuHuLi4.Text = jichu[3];
                    txtJiChuHuLi5.Text = jichu[4];
                    txtJiChuHuLi6.Text = jichu[5];
                    txtJiChuHuLi7.Text = jichu[6];
                    txtJiChuHuLi8.Text = jichu[7];
                    txtJiChuHuLi9.Text = jichu[8];
                    txtJiChuHuLi10.Text = jichu[9];
                    txtJiChuHuLi11.Text = jichu[10];
                    txtJiChuHuLi12.Text = jichu[11];
                }
                #endregion

                #region 出量
                if (!string.IsNullOrEmpty(nri.ChuLiang.NiaoLiang))
                {
                    var niaoliang = nri.ChuLiang.NiaoLiang.Split('#');
                    txtNL1.Text = niaoliang[0];
                    txtNL2.Text = niaoliang[1];
                    txtNL3.Text = niaoliang[2];
                    txtNL4.Text = niaoliang[3];
                    txtNL5.Text = niaoliang[4];
                    txtNL6.Text = niaoliang[5];
                    txtNL7.Text = niaoliang[6];
                    txtNL8.Text = niaoliang[7];
                    txtNL9.Text = niaoliang[8];
                    txtNL10.Text = niaoliang[9];
                    txtNL11.Text = niaoliang[10];
                    txtNL12.Text = niaoliang[11];
                }
                if (!string.IsNullOrEmpty(nri.ChuLiang.DaBian))
                {
                    var dabian = nri.ChuLiang.DaBian.Split('#');
                    txtDB1.Text = dabian[0];
                    txtDB2.Text = dabian[1];
                    txtDB3.Text = dabian[2];
                    txtDB4.Text = dabian[3];
                    txtDB5.Text = dabian[4];
                    txtDB6.Text = dabian[5];
                    txtDB7.Text = dabian[6];
                    txtDB8.Text = dabian[7];
                    txtDB9.Text = dabian[8];
                    txtDB10.Text = dabian[9];
                    txtDB11.Text = dabian[10];
                    txtDB12.Text = dabian[11];
                }
                if (!string.IsNullOrEmpty(nri.ChuLiang.NiaoFenJieHe))
                {
                    var niaofen = nri.ChuLiang.NiaoFenJieHe.Split('#');
                    txtNFHH1.Text = niaofen[0];
                    txtNFHH2.Text = niaofen[1];
                    txtNFHH3.Text = niaofen[2];
                    txtNFHH4.Text = niaofen[3];
                    txtNFHH5.Text = niaofen[4];
                    txtNFHH6.Text = niaofen[5];
                    txtNFHH7.Text = niaofen[6];
                    txtNFHH8.Text = niaofen[7];
                    txtNFHH9.Text = niaofen[8];
                    txtNFHH10.Text = niaofen[9];
                    txtNFHH11.Text = niaofen[10];
                    txtNFHH12.Text = niaofen[11];
                }

                if (!string.IsNullOrEmpty(nri.ChuLiang.QiTa))
                {
                    var qita = nri.ChuLiang.QiTa.Split('#');
                    txtOther1.Text = qita[0];
                    txtOther2.Text = qita[1];
                    txtOther3.Text = qita[2];
                    txtOther4.Text = qita[3];
                    txtOther5.Text = qita[4];
                    txtOther6.Text = qita[5];
                    txtOther7.Text = qita[6];
                    txtOther8.Text = qita[7];
                    txtOther9.Text = qita[8];
                    txtOther10.Text = qita[9];
                    txtOther11.Text = qita[10];
                    txtOther12.Text = qita[11];
                    txtOther13.Text = qita[12];
                    txtOther14.Text = qita[13];
                    txtOther15.Text = qita[14];
                    txtOther16.Text = qita[15];
                    txtOther17.Text = qita[16];
                    txtOther18.Text = qita[17];
                    txtOther19.Text = qita[18];
                    txtOther20.Text = qita[19];
                    txtOther21.Text = qita[20];
                    txtOther22.Text = qita[21];
                    txtOther23.Text = qita[22];
                    txtOther24.Text = qita[23];
                }
                #endregion

                txtHuLiCuoShi.Text = nri.BingQingJiCuoShi;

                txtZongruliang.Text = nri.ShiErXiaoShiChuRuLiang.ZongRuLiang;
                txtWeichangruliang.Text = nri.ShiErXiaoShiChuRuLiang.WeiChangRuLiang;
                txtJingmairuliang.Text = nri.ShiErXiaoShiChuRuLiang.JingMaiRuLiang;
                txtqita1.Text = nri.ShiErXiaoShiChuRuLiang.ZongRuLiangQiTa;
                txtzongchuliang.Text = nri.ShiErXiaoShiChuRuLiang.ZongChuLiang;
                txtniaoliang.Text = nri.ShiErXiaoShiChuRuLiang.NiaoLiang;
                txtdabian.Text = nri.ShiErXiaoShiChuRuLiang.DaBian;
                txtniaofenhunhe.Text = nri.ShiErXiaoShiChuRuLiang.NiaoFenJieHe;
                txtqita2.Text = nri.ShiErXiaoShiChuRuLiang.ZongChuLiangQiTa;
                txtqianming.Text = nri.HuShiQianMing;
                txtqianmingshangye.Text = nri.HuShiQianMingShangYe;
                txtqianmingxiaye.Text = nri.HuShiQianMingXiaYe;
            }
            else if (ret.Code == 2) { return; }
            else { MessageBox.Show(ret.M); }
        }

        #region 保存
        private void simplebaocun_Click(object sender, EventArgs e)
        {
            Model.NursingRecordsIntegration nri = new Model.NursingRecordsIntegration();
            nri.ShengMingTiZheng.T = txtTiWen1.Text + "#" + txtTiWen2.Text + "#" + txtTiWen3.Text + "#" + txtTiWen4.Text + "#" + txtTiWen5.Text + "#" + txtTiWen6.Text + "#" + txtTiWen7.Text + "#" + txtTiWen8.Text + "#" + txtTiWen9.Text + "#" + txtTiWen10.Text + "#" + txtTiWen11.Text + "#" + txtTiWen12.Text;
            nri.ShengMingTiZheng.HR = txtHrp1.Text + "#" + txtHrp2.Text + "#" + txtHrp3.Text + "#" + txtHrp4.Text + "#" + txtHrp5.Text + "#" + txtHrp6.Text + "#" + txtHrp7.Text + "#" + txtHrp8.Text + "#" + txtHrp9.Text + "#" + txtHrp10.Text + "#" + txtHrp11.Text + "#" + txtHrp12.Text;
            nri.ShengMingTiZheng.R = txtR1.Text + "#" + txtR2.Text + "#" + txtR3.Text + "#" + txtR4.Text + "#" + txtR5.Text + "#" + txtR6.Text + "#" + txtR7.Text + "#" + txtR8.Text + "#" + txtR9.Text + "#" + txtR10.Text + "#" + txtR11.Text + "#" + txtR12.Text;
            nri.ShengMingTiZheng.BP = txtBP1.Text + "#" + txtBP2.Text + "#" + txtBP3.Text + "#" + txtBP4.Text + "#" + txtBP5.Text + "#" + txtBP6.Text + "#" + txtBP7.Text + "#" + txtBP8.Text + "#" + txtBP9.Text + "#" + txtBP10.Text + "#" + txtBP11.Text + "#" + txtBP12.Text;
            nri.ShengMingTiZheng.SPO2 = txtSOP1.Text + "#" + txtSOP2.Text + "#" + txtSOP3.Text + "#" + txtSOP4.Text + "#" + txtSOP5.Text + "#" + txtSOP6.Text + "#" + txtSOP7.Text + "#" + txtSOP8.Text + "#" + txtSOP9.Text + "#" + txtSOP10.Text + "#" + txtSOP11.Text + "#" + txtSOP12.Text;

            nri.YiShi.YiShiZhuangTai = txtYszt1.Text + "#" + txtYszt2.Text + "#" + txtYszt3.Text + "#" + txtYszt4.Text + "#" + txtYszt5.Text + "#" + txtYszt6.Text + "#" + txtYszt7.Text + "#" + txtYszt8.Text + "#" + txtYszt9.Text + "#" + txtYszt10.Text + "#" + txtYszt11.Text + "#" + txtYszt12.Text;
            nri.YiShi.TongKongDaXiao = txtTkdx1.Text + "#" + txtTkdx2.Text + "#" + txtTkdx3.Text + "#" + txtTkdx4.Text + "#" + txtTkdx5.Text + "#" + txtTkdx6.Text + "#" + txtTkdx7.Text + "#" + txtTkdx8.Text + "#" + txtTkdx9.Text + "#" + txtTkdx10.Text + "#" + txtTkdx11.Text + "#" + txtTkdx12.Text;
            nri.YiShi.TongKongDuiGuangFansShe = txtTkdgfs1.Text + "#" + txtTkdgfs2.Text + "#" + txtTkdgfs3.Text + "#" + txtTkdgfs4.Text + "#" + txtTkdgfs5.Text + "#" + txtTkdgfs6.Text + "#" + txtTkdgfs7.Text + "#" + txtTkdgfs8.Text + "#" + txtTkdgfs9.Text + "#" + txtTkdgfs10.Text + "#" + txtTkdgfs11.Text + "#" + txtTkdgfs12.Text;

            nri.HuLi.FanShen = txtFanshen1.Text + "#" + txtFanshen2.Text + "#" + txtFanshen3.Text + "#" + txtFanshen4.Text + "#" + txtFanshen5.Text + "#" + txtFanshen6.Text + "#" + txtFanshen7.Text + "#" + txtFanshen8.Text + "#" + txtFanshen9.Text + "#" + txtFanshen10.Text + "#" + txtFanshen11.Text + "#" + txtFanshen12.Text;
            nri.HuLi.WuHua = txtWuhua1.Text + "#" + txtWuhua2.Text + "#" + txtWuhua3.Text + "#" + txtWuhua4.Text + "#" + txtWuhua5.Text + "#" + txtWuhua6.Text + "#" + txtWuhua7.Text + "#" + txtWuhua8.Text + "#" + txtWuhua9.Text + "#" + txtWuhua10.Text + "#" + txtWuhua11.Text + "#" + txtWuhua12.Text;
            nri.HuLi.XiTan = txtXiTan1.Text + "#" + txtXiTan2.Text + "#" + txtXiTan3.Text + "#" + txtXiTan4.Text + "#" + txtXiTan5.Text + "#" + txtXiTan6.Text + "#" + txtXiTan7.Text + "#" + txtXiTan8.Text + "#" + txtXiTan9.Text + "#" + txtXiTan10.Text + "#" + txtXiTan11.Text + "#" + txtXiTan12.Text;
            nri.HuLi.JiChuHuLi = txtJiChuHuLi1.Text + "#" + txtJiChuHuLi2.Text + "#" + txtJiChuHuLi3.Text + "#" + txtJiChuHuLi4.Text + "#" + txtJiChuHuLi5.Text + "#" + txtJiChuHuLi6.Text + "#" + txtJiChuHuLi7.Text + "#" + txtJiChuHuLi8.Text + "#" + txtJiChuHuLi9.Text + "#" + txtJiChuHuLi10.Text + "#" + txtJiChuHuLi11.Text + "#" + txtJiChuHuLi12.Text;

            nri.ChuLiang.NiaoLiang = txtNL1.Text + "#" + txtNL2.Text + "#" + txtNL3.Text + "#" + txtNL4.Text + "#" + txtNL5.Text + "#" + txtNL6.Text + "#" + txtNL7.Text + "#" + txtNL8.Text + "#" + txtNL9.Text + "#" + txtNL10.Text + "#" + txtNL11.Text + "#" + txtNL12.Text;
            nri.ChuLiang.DaBian = txtDB1.Text + "#" + txtDB2.Text + "#" + txtDB3.Text + "#" + txtDB4.Text + "#" + txtDB5.Text + "#" + txtDB6.Text + "#" + txtDB7.Text + "#" + txtDB8.Text + "#" + txtDB9.Text + "#" + txtDB10.Text + "#" + txtDB11.Text + "#" + txtDB12.Text;
            nri.ChuLiang.NiaoFenJieHe = txtNFHH1.Text + "#" + txtNFHH2.Text + "#" + txtNFHH3.Text + "#" + txtNFHH4.Text + "#" + txtNFHH5.Text + "#" + txtNFHH6.Text + "#" + txtNFHH7.Text + "#" + txtNFHH8.Text + "#" + txtNFHH9.Text + "#" + txtNFHH10.Text + "#" + txtNFHH11.Text + "#" + txtNFHH12.Text;
            nri.ChuLiang.QiTa = txtOther1.Text + "#" + txtOther2.Text + "#" + txtOther3.Text + "#" + txtOther4.Text + "#" + txtOther5.Text + "#" + txtOther6.Text + "#" + txtOther7.Text + "#" + txtOther8.Text + "#" + txtOther9.Text + "#" + txtOther10.Text + "#" + txtOther11.Text + "#" + txtOther12.Text + "#" + txtOther13.Text + "#" + txtOther14.Text + "#" + txtOther15.Text + "#" + txtOther16.Text + "#" + txtOther17.Text + "#" + txtOther18.Text + "#" + txtOther19.Text + "#" + txtOther20.Text + "#" + txtOther21.Text + "#" + txtOther22.Text + "#" + txtOther23.Text + "#" + txtOther24.Text;
            nri.BingQingJiCuoShi = txtHuLiCuoShi.Text;
            nri.ShiErXiaoShiChuRuLiang.ZongRuLiang = txtZongruliang.Text;
            nri.ShiErXiaoShiChuRuLiang.WeiChangRuLiang = txtWeichangruliang.Text;
            nri.ShiErXiaoShiChuRuLiang.JingMaiRuLiang = txtJingmairuliang.Text;
            nri.ShiErXiaoShiChuRuLiang.ZongRuLiangQiTa = txtqita1.Text;
            nri.ShiErXiaoShiChuRuLiang.ZongChuLiang = txtzongchuliang.Text;
            nri.ShiErXiaoShiChuRuLiang.NiaoLiang = txtniaoliang.Text;
            nri.ShiErXiaoShiChuRuLiang.DaBian = txtdabian.Text;
            nri.ShiErXiaoShiChuRuLiang.NiaoFenJieHe = txtniaofenhunhe.Text;
            nri.ShiErXiaoShiChuRuLiang.ZongChuLiangQiTa = txtqita2.Text;
            nri.HuShiQianMing = txtqianming.Text;
            nri.HuShiQianMingShangYe = txtqianmingshangye.Text;
            nri.HuShiQianMingXiaYe = txtqianmingxiaye.Text;
            nri.RiQi = dateriqi.DateTime.ToString();

            nri.FormId = (int)FormType.NursingRecordsIntegration;
            nri.FormName = EnumHelper.GetDescription(FormType.NursingRecordsIntegration);
            record.NursingFormData = XmlUtil.ObjectToXML(nri, Encoding.UTF8);
            record.FormId = nri.FormId;//表单ID
            record.FormName = nri.FormName;//表单NAME
            record.PatientId = PatientInfo.PATIENT_ID;//住院号
            record.VisitId = PatientInfo.VISIT_ID;//住院次数
            record.PatientName = PatientInfo.PATIENT_NAME;//患者名称
            record.BedNo = PatientInfo.BED_NO;//床号
            record.DepartmentId = PatientInfo.DEPARTMENT_ID;//科室号
            record.DepartmentName = PatientInfo.DEPARTMENT_NAME;//科室名称
            record.AreaId = PatientInfo.NURSE_CELL_CODE;//病区编号
            record.AreaName = PatientInfo.NURSE_CELL_NAME;//病区名称
            record.AssessmentDate = dateriqi.DateTime;//日期  
            record.Id = Id == "" ? 0 : Convert.ToInt32(Id);
            var ret = formService.SetNursingFormRecord(Newtonsoft.Json.JsonConvert.SerializeObject(record));
            if (ret.Code == 1)
            {
                MessageBox.Show(record.Id == 0 ? "新增成功" : "更新成功");
                if (record.Id > 0) return;
                //新增成功后绑定数据
                this.Id = string.Empty;
                BindInfo(this.Id);
            }
            else
            {
                MessageBox.Show(ret.M);
            }
        }
        #endregion

        #region 刷新
        private void simplequxiao_Click(object sender, EventArgs e)
        {
            BindInfo(this.Id);
        }
        #endregion

        private void btnPrint_Click(object sender, EventArgs e)
        {
            NursingRecordsIntegrationPrints frm = new NursingRecordsIntegrationPrints(LoginUser, PatientInfo, this.Id);
            frm.Show();
        }
    }
}
